class Compile{
    constructor(el,vm){
        this.vm=vm
        this.el=this.isElementNode(el)?
        el:document.getElementById(el)
    }
    isElementNode(node){
        return node.nodeType===1
    }
}

class Observer{
    constructor(data){
        this.observer(data)
    }
    observer(data){
        if(data&&typeof data==="object"){
            for(let key in data){
                this.observerNode(data,key,data[key])
            }
        }
    }
    observerNode(obj,key,value){
        this.observer(value)
        Object.defineProperty(obj,key,{
            get(){
                return value
            },
            set:(newvalue)=>{
                console.log(this);
                if(value!==newvalue){
                    this.observer(newvalue)
                    value=newvalue
                }
            }
        })
    }
}

class Vue{
    constructor(options={}){
        this.el=options.el
        this.data=options.data
        if(this.el){
            new Compile(this.el,this)
            new Observer(this.data)
        }
    }
    
}